package dao.oc_property_tools;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import entitybean.oc_property_tools.EntityBean_Oc_Property_Tools;
public class DaoImpl_Oc_Property_Tools  extends HibernateDaoSupport implements Dao_Oc_Property_Tools{
	public void Insert_Oc_Property_Tools(EntityBean_Oc_Property_Tools e)
	{
		this.getHibernateTemplate().save(e);
	}
	public void Update_Oc_Property_Tools(EntityBean_Oc_Property_Tools e)
	{
		this.getHibernateTemplate().update(e);
	}
	public void Delete_Oc_Property_Tools(EntityBean_Oc_Property_Tools e)
	{
		this.getHibernateTemplate().delete(e);
	}
	@SuppressWarnings("unchecked")
	public List<EntityBean_Oc_Property_Tools> Find_EntityBean_Oc_Property_Tools_by_property_id(Integer id)
	{
		return this.getHibernateTemplate().find("from EntityBean_Oc_Property_Tools where del='OFF' and pid="+id);
	}
	@SuppressWarnings("unchecked")
	public EntityBean_Oc_Property_Tools Find_EntityBean_Oc_Property_Tools_by_Id(String id)
	{
		EntityBean_Oc_Property_Tools e=new EntityBean_Oc_Property_Tools();
		List<EntityBean_Oc_Property_Tools> l=this.getHibernateTemplate().find("from EntityBean_Oc_Property_Tools where del='OFF' and id="+id);
		if(l.size()>0)
		{
			e=l.get(0);
			
			
		}
		return e;
	}
	@SuppressWarnings("unchecked")
	public List<EntityBean_Oc_Property_Tools> Find_EntityBean_Oc_Property_Tools_Is_Active()
	{
		
		List<EntityBean_Oc_Property_Tools> list=this.getHibernateTemplate().find("from EntityBean_Oc_Property_Tools where del='OFF'");	
		return list;
		
	}
	
	@SuppressWarnings("unchecked")
	public void Delete_Oc_Property_Tools(String id)
	{
		List<EntityBean_Oc_Property_Tools> list=this.getHibernateTemplate().find("from EntityBean_Oc_Property_Tools where del='OFF' and id in("+id+")");	
		for(int i=0;i<list.size();i++)
		{
			EntityBean_Oc_Property_Tools e=list.get(i);
			e.setDel("ON");
			this.getHibernateTemplate().update(e);
			
		}
		
	}
}
